Timing of a motion is one of the most important elements in animation. It affects both physical and emotional meaning of the movement. Timing can give the illusion of weight and size of an object, as well as the emotional state of a character. For example, if a character pushes forward a heavy object, he should do it much slower than pushing a light object. Animators must figure out a good timing for the anticipation of an action, the action itself, and the reaction to the action.
Walking is an interesting motion; no two people in the world walk the same. By watching a person's walk, you can interpret a massive amount of information right away. Is he old or young? Is he happy or sad? What is his financial position?
In this assignment, your goal is to make a basic walk cycle animation more
expressive in two different ways:
1. Using the Motion Capture code base
2. Using Maya
You need to think about how to add characteristics or emotions to the character by editing its motion. At the same time, it is very important to familiarize yourself with ASF/AMC files as well as the viewer code base for next project.
Your handin directory is at /afs/cs.cmu.edu/academic/class/15464-s13-users/andrewid. You should provide:
1. Motion Capture:
Load .asf/.amc files into your program and try to manipulate the timing and the
movement of the character.
Use this ASF file as the skeleton file.
Use this AMC file as the motion file.
(You can also explore and pick your own from the database,
but you are required to submit at least one video using this basic walk cycle)
You can choose how you want to edit the motion:
2. Maya:
We will give you a rigged character with a basic walk cycle. You need to figure out how to make the motion more expressive by changing the key frames of the animation. You can work on changing the timing of it or just tweak the motion of the character. We will also provide you an animation guide which you can refer to.
Use this maya file.
Before you open the file, please set Maya to Z-up. (Window->Settings/Preferences->Preferences->Settings, set the up axis to z.)
If you are not familiar with Maya, here is a basic tutorial.
You can also click "Help"->"Maya Help" for more thorough documentation.
You can also look at the Lynda tutorials that CMU provides for free. Maya Essentials 1: Interface and Organization and Maya Essentials 5: Animation Tools should be useful for this assignment.
Tips:
You might want to observe how people walk by watching them. You can also pay attention to how your own body moves while you are walking.You may want to think about the following questions:
Compiling the code:
If you want to use the amc viewer code as your starter code, you can get it here:
AMCViewer.zip
Windows:
Use the Visual Studio 2010 solution file provided in the ide/VS2010 directory. All the dependencies should be provided with the project zip file.OSX:
You need to have the SDL library installed. There are two ways to install SDL if you don't have it.Linux:
This code can be compiled using ftjam, which is available from:Running the code:
By default, the the viewer expects a "Skeleton.ASF" file with the AMC file in the
"dist/data" directory, but you can specify a different path if you like.
A simple camera control is provided. Use the left mouse button to rotate, middle
mouse button to zoom in/out, and the right mouse button to pan the camera.
Space bar can be used to Play/Play in slow motion/Pause. Tab key can be
used to toggle the camera movement.
Using the code:
Reading
===============
#include <Library/Library.hpp>
#include <Character/Character.hpp>
Library::init("my/data/folder");
for (unsigned int idx = 0; idx < Library::motion_count(); ++idx) {
Library::Motion const &m = Library::motion(idx);
for (unsigned int f = 0; f < m.frames(); ++f) {
Character::Pose my_pose;
m.get_pose(f, my_pose);
}
}
The function Library::init Scans the given directory for amc/afs files and loads them. You can retrieve these loaded files by calling
Library::motion(index) with 0 <= index <= Library::motion_count() .
Manipulating
============
Each motion represents the state of a character over time. The basic representation of this state is a Character::Pose.
You can get a pose from a motion by calling:
m.get_pose(20, my_pose); //get pose at frame 20 into my_pose
m.get_local_pose(20, my_local_pose); //get pose -- without root translation -- into my_local_pose.
Poses can be transformed into two other representations, Angles and WorldBones.
Angles
---------
#include <Character/Character.hpp>
Character::Angles angles;
my_pose.to_angles(angles);
//...modify angles...
angles.to_pose(my_pose);
Angles are raw joint-angle data, or basically what you would get if you just read the amc file yourself.
WorldBones
------------
#include <Character/pose_utils.hpp>
Character::WorldBones wb;
get_world_bones(my_pose, wb);
//... do something with wb
//NOTE: no function to convert back.
WorldBones give you the absolute position of the base and tip of each bone along with the orientation of the bone's coordinate frame. This means you can think about bones without worrying about transforming them by their parents.
Displaying
============
#include <Character/Draw.hpp>
State no_state;
no_state.clear();
Character::draw(my_pose, no_state)
The draw function draws a pose at a given state (== additional absolute position + orientation for root bone). It gives a basic stovepipe-y character.
Writing
============
#include <Library/WriteAsfAmc.hpp>
#include <fstream>
Library::Motion m = Library::motion(idx);
Character::Angles angles;
std::ofstream outAMC("test.amc");
Library::writeHeaderAmc(outAMC);
for(int i=0; i < m.frames(); i++){
m.get_angles(i,angles);
angles.angles[0] /= m.skeleton->length;
angles.angles[1] /= m.skeleton->length;
angles.angles[2] /= m.skeleton->length;
Library::writeFrameAmc(outAMC,i,angles);
}
outAMC.close();
Note that we need to divide out the first three angles by the scaling factor. This is because the first three angles are actually translations in the root joint, which do get affected by the scaling factor.
Motion Capture File Format:
The code base will read and display motion-captured data for you, but understanding the file format (.asf and .amc) is still very useful. The world coordinate system is Y up. The skeleton file (.asf) describes how the bones are connected, their degrees of freedom, their local coordinate system, etc. while the motion file (.amc) describes each bone's rotation angles relative to the bone's local coordinate system at each time step.
In an ASF file, each bone is described as following:
Video Recording:
Videos can be implemented in several ways. You can use the frame dumper (FrameDumper.hpp, FrameDumper.cpp in "Graphics" directory) in the code base by adding a hotkey to your program. These frames can be coalesced into a movie using software packages (ImageMagick and ffmpeg on Linux, Quicktime Pro on Mac, and VirtualDub on Windows). You can also use screen capture programs to record your videos.